The present invention relates to a programming method and a programming unit for a programmable controller, which is used to write sequence programs using both basic program instructions and application instructions which are not provided as basic program instructions.
FIG. 6 shows the general configuration of a programmable controller (hereinafter referred to as a "PC") and a programming unit of the type used in the prior art. In FIG. 6, the controller unit 1 includes the main sections of the PC, i.e. a central processing unit (hereinafter referred to as the "CPU") 2, an interface 3 to a programming unit 11 which will be discussed later, a memory 4 for storing the system program, a work area memory 5 used in executing the aforementioned system program, a memory 6 for storing user programs, and an interface 7 for inputs/outputs. An I/O unit 8 inputs external information and outputs the operation results of the CPU 2, a coupling module 9 connects the I/O interface 7 and the I/O unit 8, and a cable 10 connects the interface 3 and the programming unit 11. The unit 11 used with the above PC comprises an interface 12, a CPU 13, a system program memory 14, a work area memory 15, an auxiliary storage 16 including an (unillustrated) floppy disk and floppy disk drive, which serves as an auxiliary memory area for storing application instruction execution programs corresponding to the above mentioned application instructions, a keyboard 17, and a display device 18.
FIG. 7 is a block diagram showing the main functions of the programming unit 11 of the prior art. The function blocks may be appropriately termed either as "tasks" or as module. The latter terminology will be employed herein. The functional modules (tasks) are performed/exhibited when the system program stored in the system program memory 14 is run by the CPU 13. In FIG. 7, the numeral 20 indicates a main program describing module for describing a sequence program. At 22 is a main program display module for causing the sequence program described by the main program describing module 20 to be displayed on a screen of the display device 18 in FIG. 6. At 26 is an application instruction execution program reading module for reading the application instruction execution programs corresponding to the application instructions used in the above sequence program for the auxiliary storage 16. Finally, 28 indicates a program combining module for combining the read-out application instruction execution programs with the sequence program.
FIG. 8 is a flowchart showing the processing procedure of sequence program writing in the prior art. According to this flowchart, an operator starts up the programming unit 11 shown in FIG. 6 at step 200. At Step 201 the operator writes a sequence program from the keyboard 17. The program is displayed on the display device screen at the same time. Namely, the main program describing module 20 in FIG. 7 creates a sequence program 30a as represented by the ladder diagram shown in FIG. 9 in accordance with data, basic instructions and application instructions entered from the keyboard 17 in FIG. 6 and stores it in a main memory area 14a of the system program memory 14 and also displays it in ladder form on the display device 18 through the main program displaying module 22. The application instructions are each indicated in the above sequence program 30a, as shown in, for example, the program segment of FIG. 9, by subprogram operation codes, for example "SUB" or "SUBP" ("P" indicates a one time command) and the head absolute address, e.g. H75, H100, H120, of the memory area which will store the application instruction execution programs corresponding to the application instructions, in order to call subroutines. At step 202, the operator selects and reads out the application instruction execution programs which execute the application instructions he wishes to use in the sequence program 30, e.g. sine "SIN", cosine "COS", tangent "TAN", etc. The desired programs are read out one by one from among those stored in the auxiliary storage module 16 through the application instruction execution program reading module 26. This is essentially a manual task on the part of the operator. That is, the operator must access the auxiliary storage where the instruction execution programs are stored, typically on a disk, and, using the disk directory, must specify the desired program. The actual program is then read out. It will ultimately be stored in the memory starting at the designated address (i.e. H75, etc.). The operation designators "SIN", "COS" and "TAN" appear on the display device screen as shown in FIG. 10 as the instruction execution programs are designated. At step 203, the operator judges whether all the application instruction execution programs required for the given sequence program 30 have been read or not. If the answer is no, he returns to step 202. If all the programs have been read out, the operator combines the above application instruction execution programs with the sequence program 30 stored in the main memory area 14a of the system program memory 14 using the program combining task 28, at step 204, thus completing construction of sequence program. The completed sequence program is then transferred from the programming unit 11 to the user program memory 6 in the controller unit 1 via the cable 10 in FIG. 6 and is used as a PC sequence program.
Because the programming unit 11 of the prior art is configured as described above, programming is extremely troublesome, i.e. it is necessary for the user to manually specify, one by one, the application instruction execution programs corresponding to the application instructions, since the application instructions are not available as basic program instructions, in reading the above application instruction execution programs from the auxiliary storage 16. It is also necessary for the operator to prompt the unit to combine the read-out application instruction execution programs with the sequence program, to complete the sequence program. It is easy for the operator to make a mistake in specifying the head address where the execution program will be found, i.e. to subsequently put the execution program in a memory location other than that designated. Further, since the operator may not have at hand information on the size of the execution program he wishes to use, he may space subsequent execution programs too far apart and use the memory inefficiently.
An object of the present invention is to solve these problems by way of a programming method and a programming unit which will allow application instructions used in a sequence program to be detected automatically, and corresponding application instruction execution programs to be automatically read from an auxiliary storage and combined with the sequence program.